package indi.entity;

import java.util.Objects;

public class Student implements Comparable<Student>{
    private int score;
    private String name;

    public Student (int score,String name){
        this.score = score;
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return score == student.score &&
                name.equalsIgnoreCase(student.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(score, name);
    }

    @Override
    public int compareTo(Student another){
        return this.score - another.score;
    }

    @Override
    public String toString(){
        return String.format("Student(name : %s, score : %d)",name,score);
    }


}
